import SwiftUI

struct IconButton: View {
    var systemName: String
    var action: () -> Void
    var isEnabled: Bool = true
    var size: CGFloat = 40
    var background: Color = Color(.systemGray6)
    var iconColor: Color = .accentColor
    
    var body: some View {
        Button(action: action) {
            Image(systemName: systemName)
                .resizable()
                .scaledToFit()
                .frame(width: size * 0.5, height: size * 0.5)
                .foregroundColor(isEnabled ? iconColor : .gray)
                .padding(size * 0.25)
                .background(background)
                .clipShape(Circle())
                .opacity(isEnabled ? 1 : 0.5)
                .scaleEffect(isEnabled ? 1 : 0.95)
                .animation(.easeInOut(duration: 0.15), value: isEnabled)
        }
        .disabled(!isEnabled)
    }
}

#Preview {
    HStack(spacing: 20) {
        IconButton(systemName: "heart.fill", action: {})
        IconButton(systemName: "plus", action: {}, isEnabled: false)
    }.padding()
} 